<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>返回字符串描述的错误代码</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.curl-multi-strerror" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">curl_multi_strerror</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.5.0, PHP 7)</p><p class="refpurpose"><span class="refname">curl_multi_strerror</span> &mdash; <span class="dc-title">返回字符串描述的错误代码</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.curl-multi-strerror-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>curl_multi_strerror</strong></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$errornum</code></span>
   ) : <span class="type">string</span></div>

  <p class="para rdfs-comment">
   返回一个用以描述所给 CURLM 错误代码所对应的错误信息。
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-function.curl-multi-strerror-parameters">
  <h3 class="title">参数</h3>
  <dl>

   
    <dt>
<code class="parameter">errornum</code></dt>

    <dd>

     <p class="para">
      <a href="http://curl.haxx.se/libcurl/c/libcurl_errors.html" class="link external">&raquo;&nbsp;CURLM 错误代码</a>中的常量之一。
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.curl-multi-strerror-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   返回可用错误代码所对应的错误信息，否则返回 <strong><code>NULL</code></strong> 。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.curl-multi-strerror-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-5248">
    <p><strong>Example #1 <span class="function"><strong>curl_multi_strerror()</strong></span> 函数的范例：</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;Create&nbsp;cURL&nbsp;handles<br /></span><span style="color: #0000BB">$ch1&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">curl_init</span><span style="color: #007700">(</span><span style="color: #DD0000">"http://example.com"</span><span style="color: #007700">/);<br /></span><span style="color: #0000BB">$ch2&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">curl_init</span><span style="color: #007700">(</span><span style="color: #DD0000">"http://php.net/"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Create&nbsp;a&nbsp;cURL&nbsp;multi&nbsp;handle<br /></span><span style="color: #0000BB">$mh&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">curl_multi_init</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">//&nbsp;Add&nbsp;the&nbsp;handles&nbsp;to&nbsp;the&nbsp;multi&nbsp;handle<br /></span><span style="color: #0000BB">curl_multi_add_handle</span><span style="color: #007700">(</span><span style="color: #0000BB">$mh</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$ch1</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">curl_multi_add_handle</span><span style="color: #007700">(</span><span style="color: #0000BB">$mh</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$ch2</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Execute&nbsp;the&nbsp;multi&nbsp;handle<br /></span><span style="color: #007700">do&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$status&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">curl_multi_exec</span><span style="color: #007700">(</span><span style="color: #0000BB">$mh</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$active</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;Check&nbsp;for&nbsp;errors<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if(</span><span style="color: #0000BB">$status&nbsp;</span><span style="color: #007700">&gt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;Display&nbsp;error&nbsp;message<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"ERROR!\n&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">curl_multi_strerror</span><span style="color: #007700">(</span><span style="color: #0000BB">$status</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}&nbsp;while&nbsp;(</span><span style="color: #0000BB">$status&nbsp;</span><span style="color: #007700">===&nbsp;</span><span style="color: #0000BB">CURLM_CALL_MULTI_PERFORM&nbsp;</span><span style="color: #007700">||&nbsp;</span><span style="color: #0000BB">$active</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.curl-multi-strerror-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="curl_strerror.html" class="function" rel="rdfs-seeAlso">curl_strerror()</a> - 返回错误代码的字符串描述</span></li>
    <li class="member"><a href="http://curl.haxx.se/libcurl/c/libcurl_errors.html" class="link external">&raquo;&nbsp;cURL error codes</a></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>